package notifysource

type NotifySourceEnum int

const (
	Alarm NotifySourceEnum = iota + 1
	UseOperate
	SystemTask
)

//自定义返回枚举类型
type notifySource struct {
	Source string
	Value  string
}

func (it NotifySourceEnum) Get() notifySource {
	switch it {
	case Alarm:
		return notifySource{Source: "1", Value: "告警"}
	case UseOperate:
		return notifySource{Source: "2", Value: "用户操作"}
	case SystemTask:
		return notifySource{Source: "3", Value: "系统任务"}
	default:
		return notifySource{}
	}
}

func GetNotifySource(source string) notifySource {
	switch source {
	case Alarm.Get().Source:
		return Alarm.Get()
	case UseOperate.Get().Source:
		return UseOperate.Get()
	case SystemTask.Get().Source:
		return SystemTask.Get()
	default:
		return notifySource{}
	}
}
